package edu.utsa.cs.contactmanager;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;

@SuppressWarnings("serial")
public class Contact implements Serializable{

	private long id = -1;
	private String firstName; 
	private String lastName;
	private ArrayList<String> phoneNums; 
	private String email; 
	private String picture; 
	private boolean blackListed;
	
	
	public Contact(String f, String l, String e, String pic, boolean black)
	{
		firstName = f; 
		lastName = l; 
		email = e;
		picture = pic; 
		blackListed = black; 
		
		phoneNums = new ArrayList<String>();
	}
	
	public Contact()
	{
		this("John", "Doe", "", "", false); 
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public ArrayList<String> getPhoneNums() {
		return phoneNums;
	}

	public void addPhoneNum(String phoneNum) {
		this.phoneNums.add(phoneNum);
	}
	
	public void removePhoneNum(String phoneNum) {
		Iterator<String> i = phoneNums.iterator();
		String c;
		while(i.hasNext()){
			c = i.next();
			if(c.equals(phoneNum)){
				i.remove();//Safety
				break;
			}
		}
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public boolean isBlackListed() {
		return blackListed;
	}

	public void setBlackListed(boolean blackListed) {
		this.blackListed = blackListed;
	}
	
	public long getID(){
		return id;
	}
	
	public void setID(long id){
		this.id = id;
	}
	
	@Override
	public String toString(){
		return String.format("Contact: %s %s | ID: %d", this.firstName, this.lastName, this.id);
	}

	
}
